package concurrent.blockingQueue;

import java.util.concurrent.PriorityBlockingQueue;

/**
 * 线程安全的优先队列，内部是由数组实现的最小堆
 * @author tuyou
 * @date 2020-08-19 23:20:26
 */
public class PriorityBlockingQueueTest {

	public static void main(String[] args) {

		PriorityBlockingQueue<String> list = new PriorityBlockingQueue<>();
		list.add("e");
		list.add("b");
		list.add("c");
		list.add("a");
		System.out.println(list);
		
		System.out.println(list.poll());
		System.out.println(list.poll());
		System.out.println(list.poll());
		System.out.println(list.poll());
		System.out.println(list.poll());
	}
}
